package com.giscloud.limp.entity;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 一审案件信息
 * 
 * @author giscloud
 * @email giscloud@giscloud.com
 * @date 2020-06-10 14:25:28
 */
@Data
public class CaseFirstInstance implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 案件ID
	 */
	@ExcelIgnore
   private Integer caseId;
	/**
	 * 案件类别 1|诉讼;2|仲裁
	 */
	@ExcelIgnore
   private Integer caseType;
	/**
	 * 案件编号 单位编号(org_id)+YYYYMMDD+案件类别(01/02)+编号(两位)
	 */
	@ExcelProperty(value = "案件档案号", index = 0)
   private String caseCode;
	/**
	 * 案件名称 (原告)诉(被告)(案由)
	 */
	@ExcelProperty(value = "案件名称", index = 1)
   private String caseName;
	/**
	 * 案件说明
	 */
	@ExcelIgnore
   private String caseDescription;
	/**
	 * 项目ID
	 */
	@ExcelIgnore
   private Integer legalProjectId;
	/**
	 * 项目名称
	 */
	@ExcelIgnore
   private String legalProjectName;
	/**
	 * 责任主体
	 */
	@ExcelIgnore
   private String legalDuty;
	/**
	 * 一审案件号
	 */
	@ExcelProperty(value = "一审案件号", index = 2)
   private String firstCaseCode;
	/**
	 * 诉讼类型 1|主诉;2|被诉
	 */
	@ExcelIgnore
   private Integer litigationType;
	/**
	 * 诉讼类型显示值
	 */
	@ExcelProperty(value = "主诉或被诉", index = 3)
	private String litigationTypeStr;
	/**
	 * 案由 字典值
	 */
	@ExcelIgnore
   private Integer actionCause;
	/**
	 * 案由 显示值
	 */
	@ExcelProperty(value = "案由", index = 5)
	private String actionCauseStr;
	/**
	 * 第三人
	 */
	@ExcelIgnore
   private String thirdParty;
	/**
	 * 起诉时间
	 */
	@ExcelProperty(value = "起诉时间", index = 4)
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
   private Date prosecutionDate;
	/**
	 * 诉讼标的额
	 */
	@ExcelProperty(value = "诉讼标的额（元）", index = 8)
   private BigDecimal litigationAmount;
	/**
	 * 诉讼请求
	 */
	@ExcelProperty(value = "诉讼请求", index = 9)
   private String litigationClaim;
	/**
	 * 是否是重大案件 1|是;2|否
	 */
	@ExcelIgnore
   private Integer majorCaseFlag;

	/**
	 * 是否是重大案件 显示值
	 */
	@ExcelProperty(value = "是否重大案件", index = 10)
	private String majorCaseFlagStr;


	/**
	 * 受理法院/仲裁机构
	 */
	@ExcelProperty(value = "受理法院", index = 11)
   private String acceptanceCourt;
	/**
	 * 受理法院类型
	 */
	@ExcelIgnore
   private String courtType;
	/**
	 * 办案人
	 */
	@ExcelIgnore
   private String caseHandler;
	/**
	 * 办案人联系方式
	 */
	@ExcelIgnore
   private String caseHandlerTel;
	/**
	 * 是否冻结账户 1|是;2|否
	 */
	@ExcelIgnore
   private Integer freezeAccountFlag;

	/**
	 * 是否冻结账户 显示值
	 */
	@ExcelProperty(value = "是否冻结账户", index = 12)
	private String freezeAccountFlagStr;

	/**
	 * 开户银行
	 */
	@ExcelProperty(value = "开户行", index = 13)
   private String depositBank;
	/**
	 * 银行账户
	 */
	@ExcelProperty(value = "账号", index = 14)
   private String bankAccount;
	/**
	 * 冻结金额
	 */
	@ExcelProperty(value = "冻结金额", index = 15)
   private BigDecimal frozenAmount;
	/**
	 * 冻结状态 1|冻结;2|挂扣
	 */
	@ExcelIgnore
   private Integer frozenStatus;
	/**
	 * 备注
	 */
	@ExcelIgnore
   private String remark;
	/**
	 * 案件处理意见
	 */
	@ExcelIgnore
   private String caseHandlingOpinions;
	/**
	 * 一审附件
	 */
	@ExcelIgnore
   private String attachmentId;
	/**
	 * 一审附件收到时间
	 */
	@ExcelIgnore
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
   private Date attachmentReceiveDate;
	/**
	 * 其它附件
	 */
	@ExcelIgnore
   private String otherAttachmentId;
	/**
	 * 案件状态 0|未结案;1|已结案
	 */
	@ExcelIgnore
   private Integer caseStatus;

	/**
	 * 案件状态 显示值
	 */
	@ExcelProperty(value = "案件状态", index = 17)
	private String caseStatusStr;
	/**
	 * 结案类型 1|和解;2|撤诉;3|调解;4|判决
	 */
	@ExcelIgnore
   private Integer closecaseType;

	/**
	 * 结案类型 显示值
	 */
	@ExcelProperty(value = "结案类型", index = 18)
	private String closecaseTypeStr;
	/**
	 * 结案阶段 1|诉讼结案;2|审理结案
	 */
	@ExcelIgnore
   private Integer closecaseStage;
	/**
	 * 诉讼阶段 1|一审;2|二审;3|再审;4|执行;5|诉讼结案
	 */
	@ExcelIgnore
   private Integer litigationStage;

	/**
	 * 诉讼阶段 显示值
	 */
	@ExcelProperty(value = "诉讼阶段", index = 16)
	private String litigationStageStr;

	@ExcelIgnore
   private Integer statusCd;

	@ExcelIgnore
   private Integer createdStaffId;

	@ExcelIgnore
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
   private Date createdDt;

	@ExcelIgnore
   private Integer operateStaffId;

	@ExcelIgnore
   private Date version;
	/**
	 * 创建人所在机构ID
	 */
	@ExcelIgnore
   private Integer createdOrgId;

	/**
	 * 原告人列表
	 */
	@ExcelIgnore
	private List<Plaintiff> plaintiffs;

	/**
	 * 原告人姓名，多个‘，’隔开
	 */
	@ExcelProperty(value = "原告", index = 6)
	private String plaintiffsNameStr;

	/**
	 * 被告人列表
	 */
	@ExcelIgnore
   private List<Defendant> defendants;

	/**
	 * 被告人姓名，多个‘，’隔开
	 */
	@ExcelProperty(value = "被告", index = 7)
	private String defendantNameStr;

	/**
	 * 财产保全种类 1|冻结银行账户;2|查封固定资产;3|查封股权;4|查封机器设备;5|查封其他资产
	 */
	private Integer propertyPreserveType;
	/**
	 * 财产保全具体查封冻结财产情况
	 */
	private String propertyPreserveDetail;

	/**
	 * 提醒日期
	 */
	private Date warnDate;
	/**
	 * 提醒内容
	 */
	private String warnContent;



public enum Column {
						caseId("case_id","caseId","INTEGER",false),
								caseType("case_type","caseType","INTEGER",false),
								caseCode("case_code","caseCode","VARCHAR",false),
								caseName("case_name","caseName","VARCHAR",false),
								caseDescription("case_description","caseDescription","VARCHAR",false),
								legalProjectId("legal_project_id","legalProjectId","INTEGER",false),
								legalProjectName("legal_project_name","legalProjectName","VARCHAR",false),
								legalDuty("legal_duty","legalDuty","VARCHAR",false),
								firstCaseCode("first_case_code","firstCaseCode","VARCHAR",false),
								litigationType("litigation_type","litigationType","INTEGER",false),
								actionCause("action_cause","actionCause","INTEGER",false),
								thirdParty("third_party","thirdParty","VARCHAR",false),
								prosecutionDate("prosecution_date","prosecutionDate","DATE",false),
								litigationAmount("litigation_amount","litigationAmount","NUMERIC",false),
								litigationClaim("litigation_claim","litigationClaim","VARCHAR",false),
								majorCaseFlag("major_case_flag","majorCaseFlag","INTEGER",false),
								acceptanceCourt("acceptance_court","acceptanceCourt","VARCHAR",false),
								courtType("court_type","courtType","VARCHAR",false),
								caseHandler("case_handler","caseHandler","VARCHAR",false),
								caseHandlerTel("case_handler_tel","caseHandlerTel","VARCHAR",false),
								freezeAccountFlag("freeze_account_flag","freezeAccountFlag","INTEGER",false),
								depositBank("deposit_bank","depositBank","VARCHAR",false),
								bankAccount("bank_account","bankAccount","VARCHAR",false),
								frozenAmount("frozen_amount","frozenAmount","NUMERIC",false),
								frozenStatus("frozen_status","frozenStatus","INTEGER",false),
								remark("remark","remark","VARCHAR",false),
								caseHandlingOpinions("case_handling_opinions","caseHandlingOpinions","VARCHAR",false),
								attachmentId("attachment_id","attachmentId","VARCHAR",false),
								attachmentReceiveDate("attachment_receive_date","attachmentReceiveDate","DATE",false),
								otherAttachmentId("other_attachment_id","otherAttachmentId","VARCHAR",false),
								caseStatus("case_status","caseStatus","INTEGER",false),
								closecaseType("closecase_type","closecaseType","INTEGER",false),
								closecaseStage("closecase_stage","closecaseStage","INTEGER",false),
								litigationStage("litigation_stage","litigationStage","INTEGER",false),
								statusCd("status_cd","statusCd","INTEGER",false),
								createdStaffId("created_staff_id","createdStaffId","INTEGER",false),
								createdDt("created_dt","createdDt","TIMESTAMP",false),
								operateStaffId("operate_staff_id","operateStaffId","INTEGER",false),
								version("version","version","TIMESTAMP",false),
								createdOrgId("created_org_id","createdOrgId","INTEGER",false);
	    		private static final String BEGINNING_DELIMITER = "`";
	private static final String ENDING_DELIMITER = "`";
	private final String column;
	private final boolean isColumnNameDelimited;
	private final String javaProperty;
	private final String jdbcType;
	public String value() {
		return this.column;
	}
	public String getValue() {
		return this.column;
	}
	public String getJavaProperty() {
		return this.javaProperty;
	}
	public String getJdbcType() {
		return this.jdbcType;
	}
	Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
		this.column = column;
		this.javaProperty = javaProperty;
		this.jdbcType = jdbcType;
		this.isColumnNameDelimited = isColumnNameDelimited;
	}
	public String desc() {
		return this.getEscapedColumnName() + " DESC";
	}
	public String asc() {
		return this.getEscapedColumnName() + " ASC";
	}
	public static Column[] excludes(Column ... excludes) {
		ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
		if (excludes != null && excludes.length > 0) {
			columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
		}
		return columns.toArray(new Column[]{});
	}
	public String getEscapedColumnName() {
		if (this.isColumnNameDelimited) {
			return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
		} else {
			return this.column;
		}
	}
	public String getAliasedEscapedColumnName() {
		return this.getEscapedColumnName();
	}
  }

}
